package com.fullstack.app.pages.home

import cats.effect.IO
import com.fullstack.app.App
import com.fullstack.app.pages.Page
import com.fullstack.app.pages.common.{Constants, Endpoint}
import io.circe.*
import io.circe.generic.auto.*
import io.circe.parser.*
import io.circe.syntax.*
import org.scalajs.dom.{console, document, html, window}
import tyrian.Html.*
import tyrian.cmds.Logger
import tyrian.http.{HttpError, Method, Response}
import tyrian.{CSS, Cmd, Html}

import com.fullstack.app.pages.components.home.HomeLayout

/**
 * 首页
 *    展示最新文章列表
 */


case class HomePage(

                   ) extends Page:

  import HomePage.*
  import HomePage.HomePageMsg.*

  override def initCmd: Cmd[IO, App.Msg] =
    // 当点击某个类别后，再点击菜单栏的首页，需要把当前选择的样式清空
    Cmd.None

  override def update(msg: App.Msg): (Page, Cmd[IO, App.Msg]) =
    msg match

      case _ => (this, Cmd.None)
      
  end update

  override def view(): Html[App.Msg] =
    HomeLayout.view(
      div("Hello Scala Full Stack")
    )

  end view
  

end HomePage



object HomePage:

  enum HomePageMsg extends App.Msg:
    case NoOp



  import HomePageMsg.*

  private object Endpoints:


  end Endpoints


  private object Commands:


  end Commands


end HomePage
